<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!--
	파일명 : addCommonCode_p.jsp
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>코드추가</title>
	<link rel="stylesheet" type="text/css" href="/inc/css/common.css" />
	<script type="text/javascript" src="/inc/css/common.js"></script>
	
	<script language="javascript" type="text/javascript">
	//저장 버튼
	function saveCommonCode() {
	
		var group_code_nm 		= 	form.group_code_nm.value;
		var checkedUseyn 		= 	form.checkedUseyn.value;

		if(group_code_nm == ""){
			alert("대표<s:text name="alert.message.requiedCodeName" />");
			form.group_code_nm.focus();
			return false;
		}
		var cnt=0;
		for(var i=0; i<group_code_nm.length; i++){
           if(group_code_nm.charAt(i)== " "){
                 cnt++;
           }
		}
		if(group_code_nm.length == cnt){
           alert("대표코드명에 공백을 허용하지 않습니다.");
           form.group_code_nm.focus();
           return false;
		}
		if(checkedUseyn == ""){
			alert("<s:text name="alert.message.use_yn" />");
			form.checkedUseyn.focus();
			return false;
		}

		if (confirm("<s:text name="alert.message.questionSave" />")) {
			form.action="saveCommonCode.action";
			form.submit();
			
			window.close();		
	  		
	   		opener.location.reload();
		}
		
		return false;
	}
	
	
</script>
</head>
<body>
	<s:form name="form" theme="simple" >
	<div id="popup_550se_top" ></div>
		<div id="popup_550se_bg">
			<table class="pop550se_Tbl">
			<tr>
				<th>대표코드명</th>
				<td><s:textfield name="group_code_nm" cssClass="input_120se" maxlength="20" /></td>
				<th>사용여부</th>
				<td>
					<s:select name="checkedUseyn"   headerKey="" headerValue="::선택하세요::" list="#{'Y':'Y','N':'N'}" cssClass="combobox120se"/>
					<input type="hidden" name="group_cd" value="<s:property value="group_cd"/>"/>		
				</td>
			</tr>
			</table>	
			<div id="popup_btn"><s:submit type="image" src="/images/btn_save.gif" onclick="return saveCommonCode();"/></div>
		</div>

		<!---------------Bottom : STR----------->
		<div id="popup_550se_bottom"><s:submit type="image" src="/images/pop_btn_close.gif" onclick="window.close(); return false;"/></div>
		<!---------------Bottom : END----------->
	</s:form>
</body>
</html>